GtkBorder clip, margin, border, padding;
GtkCssStyle *style;
cairo_t *cr;
- GskRenderNode *box_node, *bg_node, *border_node;
+ GskRenderNode *box_node, *border_node;
graphene_rect_t bounds;
int width, height;
int contents_x, contents_y, contents_width, contents_height;
get_box_padding (style, &padding);
str = g_strconcat ("Background<", G_OBJECT_TYPE_NAME (gtk_css_gadget_get_owner (gadget)), ">", NULL);
- bg_node = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (bg_node, str);
- gsk_render_node_set_bounds (bg_node, &bounds);
- cr = gsk_render_node_get_draw_context (bg_node);
-
- gtk_css_style_render_background (style,
- cr,
- clip.left + margin.left,
- clip.top + margin.top,
- width - clip.left - clip.right - margin.left - margin.right,
- height - clip.top - clip.bottom - margin.top - margin.bottom,
- gtk_css_node_get_junction_sides (priv->node));
-
- cairo_destroy (cr);
+ gtk_css_style_add_background_render_nodes (style,
+ renderer,
+ box_node,
+ &bounds,
+ str,
+ clip.left + margin.left,
+ clip.top + margin.top,
+ width - clip.left - clip.right - margin.left - margin.right,
+ height - clip.top - clip.bottom - margin.top - margin.bottom,
+ gtk_css_node_get_junction_sides (priv->node));
g_free (str);
- gsk_render_node_append_child (box_node, bg_node);
- gsk_render_node_unref (bg_node);
-
str = g_strconcat ("Border<", G_OBJECT_TYPE_NAME (gtk_css_gadget_get_owner (gadget)), ">", NULL);
border_node = gsk_renderer_create_render_node (renderer);
gsk_render_node_set_name (border_node, str);
cairo_restore (cr);
}
+void
+gtk_css_style_add_background_render_nodes (GtkCssStyle *style,
+ GskRenderer *renderer,
+ GskRenderNode *parent_node,
+ graphene_rect_t *bounds,
+ const char *name,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkJunctionSides junction)
+{
+ GskRenderNode *bg_node;
+ cairo_t *cr;
+
+ bg_node = gsk_renderer_create_render_node (renderer);
+ gsk_render_node_set_name (bg_node, name);
+ gsk_render_node_set_bounds (bg_node, bounds);
+ cr = gsk_render_node_get_draw_context (bg_node);
+ gtk_css_style_render_background (style, cr, x, y, width, height, junction);
+ cairo_destroy (cr);
+
+ gsk_render_node_append_child (parent_node, bg_node);
+ gsk_render_node_unref (bg_node);
+}
+
static gboolean
corner_value_is_right_angle (GtkCssValue *value)
{
#include "gtkcsstypesprivate.h"
#include "gtktypes.h"
+#include "gsk/gsk.h"
G_BEGIN_DECLS
gdouble height,
GtkJunctionSides junction);
gboolean gtk_css_style_render_background_is_opaque (GtkCssStyle *style);
+void gtk_css_style_add_background_render_nodes (GtkCssStyle *style,
+ GskRenderer *renderer,
+ GskRenderNode *parent_node,
+ graphene_rect_t *bounds,
+ const char *name,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkJunctionSides junction);
+
G_END_DECLS